Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.
Example 1:
Input: "Hello"
Output: "hello"
Example 2:
Input: "here"
Output: "here"
Example 3:
Input: "LOVELY"
Output: "lovely"
這題目在Python沒有很難, 因為Python有內建的語法
這個語法就是.lower()只要找.lower輸入在str後就可以把字串變成小寫
程式碼
class Solution:
def toLowerCase(self, str):
"""
:type str: str
:rtype: str
"""
return(str.lower())
資料來源:https://leetcode.com/problems/to-lower-case/description/